package com.zengqingfa.jvm.test.n1;

/**
 * @fileName: HeapTest2
 * @author: zengqf3
 * @date: 2021-6-13 13:18
 * @description:
 */
public class HeapTest2 {

    public static void main(String[] args) throws InterruptedException {
        System.out.println("1.......");
        Thread.sleep(30000);
        // 10m的数组 分配在堆空间
        byte[] bytes = new byte[1024 * 1024 * 8];
        System.out.println("2......");
        Thread.sleep(30000);
        //bytes可以被垃圾回收
        bytes = null;
        //主动触发垃圾回收
        System.gc();
        System.out.println("3......");
        Thread.sleep(10000000);
    }
}
